﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="P2Module"
    targetNamespace="http://tempuri.org/P2Module.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/P2Module.xsd"
    xmlns:mstns="http://tempuri.org/P2Module.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="p2Module" type="P2Module"/>
  <xs:complexType name="P2Module">
    <xs:sequence>
      <xs:element name="p2Entities" type="P2Entities"/>
      <xs:element name="p2Views" type="P2Views"/>
      <xs:element name="p2Resources" type="P2Resources"/>
      <xs:element name="p2Languages" type="P2Languages"/>
      <xs:element name="p2UserGroups" type="P2UserGroups"/>
      <xs:element name="p2Workflows" type="P2Workflows"/>
      <xs:element name="p2Events" type="P2Events"/>
      <xs:element name="p2Images" type="P2Images"/>

    </xs:sequence>
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="findView" type="xs:string" />
    <xs:attribute name="mainView" type="xs:string" />
    <xs:attribute name="listView" type="xs:string" />
    <xs:attribute name="mainMenuItemId" type="xs:int" />
    <xs:attribute name="mainMenuItemName" type="xs:string" />
    <xs:attribute name="subMenuItemId" type="xs:int" />
    <xs:attribute name="subMenuItemName" type="xs:string" />

  </xs:complexType>
  <xs:complexType name="P2Entities">
    <xs:sequence>
      <xs:element name="p2Entity" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="p2Properties" type="P2Properties"/>
            <xs:element name="p2ComputedProperties" type="P2ComputedProperties"/>
            <xs:element name="p2Collections" type="P2Collections"/>
            <xs:element name="p2Validators" type="P2Validators"/>
          </xs:sequence>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="table" type="xs:string" />

        </xs:complexType>
      </xs:element>

    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2Properties">
    <xs:sequence>
      <xs:element name="p2Property" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="p2Reference" minOccurs="0" maxOccurs="1" >
              <xs:complexType>
                <xs:attribute name="entity" type="xs:string"/>
                <xs:attribute name="valuePropertyName" type="xs:string"/>
                <xs:attribute name="textPropertyName" type="xs:string"/>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="type" type="xs:string" />
          <xs:attribute name="column" type="xs:string" />
          <xs:attribute name="label" type="xs:string" />
          <xs:attribute name="default" type="xs:string" />
          <xs:attribute name="canBeNull" type="xs:boolean" default="true" />
          <xs:attribute name="isPrimaryKey" type="xs:boolean" default="false" />
          <xs:attribute name="isDbGenerated" type="xs:boolean" default="false" />
          <xs:attribute name="multiLanguage" type="xs:boolean" default="false" />
          <xs:attribute name="referencePropertyName" type="xs:string"/>
          <xs:attribute name="queryRange" type="xs:boolean" default="false"/>          
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2ComputedProperties">
    <xs:sequence>
      <xs:element name="p2ComputedProperty" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="type" type="xs:string" />
          <xs:attribute name="formula" type="xs:string" />
          <xs:attribute name="canBeNull" type="xs:boolean" default="true" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2Collections">
    <xs:sequence>
      <xs:element name="p2Collection" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence >
            <xs:element name="p2AggregateProperties" type="P2AggregateProperties" />
          </xs:sequence>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="entity" type="xs:string" />
          <xs:attribute name="key" type="xs:string" />
          <xs:attribute name="selector" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2AggregateProperties">
    <xs:sequence>
      <xs:element name="p2AggregateProperty" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="type" type="xs:string" />
          <xs:attribute name="property" type="xs:string" />
          <xs:attribute name="operation" type="xs:string" />
          <xs:attribute name="canBeNull" type="xs:boolean" default="true" />
          <xs:attribute name="default" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2Validators">
    <xs:sequence>
      <xs:element name="p2ContentValidator" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="fieldName" type="xs:string" />
          <xs:attribute name="controlType" type="xs:string" />
          <xs:attribute name="controlContentType" type="xs:string" />
          <xs:attribute name="regEx" type="xs:string" />
          <xs:attribute name="minDateTime" type="xs:dateTime" />
          <xs:attribute name="maxDateTime" type="xs:dateTime" />
          <xs:attribute name="minInt" type="xs:int" />
          <xs:attribute name="maxInt" type="xs:int"/>
          <xs:attribute name="minText" type="xs:string"/>
          <xs:attribute name="maxText" type="xs:string"/>
          <xs:attribute name="validationType" type="xs:string" default="" />
        </xs:complexType>
      </xs:element>
      <xs:element name="p2MandatoryValidator" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="fieldName" type="xs:string" />
          <xs:attribute name="validationType" type="xs:string" default="" />
        </xs:complexType>
      </xs:element>
      <xs:element name="p2UniqueValidator" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="fieldName" type="xs:string" />
          <xs:attribute name="validationType" type="xs:string" default="" />
        </xs:complexType>
      </xs:element>
      <xs:element name="p2UniqueInCombinationsValidator" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="fieldName" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="validationType" type="xs:string" default="" />
        </xs:complexType>
      </xs:element>

    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2Resources">
    <xs:sequence>
      <xs:element name="p2Resource" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="language" type="xs:string" />
          <xs:attribute name="value" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2Languages">
    <xs:sequence>
      <xs:element name="p2Language" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="languageId" type="xs:string" />
          <xs:attribute name="rtl" type="xs:boolean" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2Views">
    <xs:sequence>
      <xs:element name="p2View" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="p2ViewField" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="name" type="xs:string"/>
                <xs:attribute name="width" type="xs:string"/>
                <xs:attribute name="referenceQuery" type="xs:string"/>
                <xs:attribute name="controlType" type="xs:string"/>
                <xs:attribute name="label" type="xs:string"/>
                <xs:attribute name="column" type="xs:int"/>
                <xs:attribute name="row" type="xs:int"/>
                <xs:attribute name="colspan" type="xs:int"/>
                <xs:attribute name="rowspan" type="xs:int"/>
                <xs:attribute name="enabled" type="xs:boolean" default="true"/>
                <xs:attribute name="default" type="xs:string"/>
              </xs:complexType>

            </xs:element>
            <xs:element name="p2ViewEmbededView" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="name" type="xs:string"/>
                <xs:attribute name="width" type="xs:string"/>
                <xs:attribute name="regionName" type="xs:string"/>
                <xs:attribute name="viewName" type="xs:string"/>
                <xs:attribute name="label" type="xs:string"/>
                <xs:attribute name="column" type="xs:int"/>
                <xs:attribute name="row" type="xs:int"/>
                <xs:attribute name="colspan" type="xs:int"/>
                <xs:attribute name="rowspan" type="xs:int"/>
                <xs:attribute name="enabled" type="xs:boolean" default="true"/>
              </xs:complexType>

            </xs:element>            
            <xs:element name="p2ViewAction" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="name" type="xs:string"/>
                <xs:attribute name="width" type="xs:string"/>
                <xs:attribute name="icon" type="xs:string"/>
                <xs:attribute name="actionType" type="xs:string"/>
                <xs:attribute name="label" type="xs:string"/>
                <xs:attribute name="transactionId" type="xs:int"/>
                <xs:attribute name="enabled" type="xs:boolean" default="true"/>
                <xs:attribute name="onlyIfEdit" type="xs:boolean" default="false" />
                <xs:attribute name="sendEventName" type="xs:string" default=""/>
              </xs:complexType>

            </xs:element>
            <xs:element name="p2ViewEvent" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:attribute name="name" type="xs:string"/>
                <xs:attribute name="action" type="xs:string"/>
                <xs:attribute name="parameter" type="xs:string"/>
                <xs:attribute name="onlyIfEdit" type="xs:boolean" default="false" />
              </xs:complexType>

            </xs:element>
            <xs:element name="p2ViewSecurity" type="P2ViewSecurity" />
          </xs:sequence>
          <xs:attribute name="name" type="xs:string"/>

          <xs:attribute name="entity" type="xs:string"/>
          <xs:attribute name="type" type="xs:string"/>
          <xs:attribute name="region" type="xs:string"/>
          <xs:attribute name="columns" type="xs:int"/>
          <xs:attribute name="rows" type="xs:int"/>
          <xs:attribute name="width" type="xs:int" />
          <xs:attribute name="height" type="xs:int"/>
          <xs:attribute name="refreshEventName" type="xs:string" default=""/>

        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2ViewSecurity">
    <xs:sequence>

      <xs:element name="p2ViewRightsSpecial" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>

          <xs:attribute name="controlName" type="xs:string"/>
          <xs:attribute name="controlType" type="xs:string"/>
          <xs:attribute name="accessRight" type="xs:int"/>
          <xs:attribute name="userGroupId" type="xs:int"/>
          <xs:attribute name="statusId" type="xs:int" default="0"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="p2ViewRightsWorkflow" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>

          <xs:attribute name="controlName" type="xs:string"/>
          <xs:attribute name="controlType" type="xs:string"/>
          <xs:attribute name="accessRight" type="xs:int"/>
          <xs:attribute name="isActive" type="xs:boolean"/>
          <xs:attribute name="statusId" type="xs:int" default="0"/>
        </xs:complexType>
      </xs:element>

    </xs:sequence>

  </xs:complexType>
  <xs:complexType name="P2UserGroups">
    <xs:sequence>
      <xs:element name="p2UserGroup" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="groupId" type="xs:int"/>
          <xs:attribute name="name" type="xs:string"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="P2Workflows">
    <xs:sequence>
      <xs:element name ="p2Workflow" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="p2Statusses" type="P2Statusses"/>
            <xs:element name="p2Transactions" type="P2Transactions"/>

          </xs:sequence>
          <xs:attribute name="workflowId" type="xs:int"/>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="description" type="xs:string"/>
          <xs:attribute name="workflowObjectId" type="xs:int"/>
          <xs:attribute name="wokrflowObjectName" type="xs:string"/>
        </xs:complexType>

      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2Statusses">
    <xs:sequence>
      <xs:element name="p2Status" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="statusId" type="xs:int"/>
          <xs:attribute name="endStatus" type="xs:boolean"/>
        </xs:complexType>

      </xs:element>

    </xs:sequence>

  </xs:complexType>
  <xs:complexType name="P2Transactions">
    <xs:sequence>
      <xs:element name="p2Transaction" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="transactionId" type="xs:int"/>
          <xs:attribute name="description" type="xs:string"/>
          <xs:attribute name="startStatusId" type="xs:int"/>
          <xs:attribute name="endStatusId" type="xs:int"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="P2Events">
    <xs:sequence>
      <xs:element name="p2Event" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="entityName" type="xs:string"/>
        </xs:complexType>

      </xs:element>

    </xs:sequence>

  </xs:complexType>
  <xs:complexType name="P2Images">
    <xs:sequence>
      <xs:element name="p2Image" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string"/>
          <xs:attribute name="width" type="xs:int"/>
          <xs:attribute name="height" type="xs:int" />
          <xs:attribute name="fileName" type="xs:string"/>
        </xs:complexType>

      </xs:element>

    </xs:sequence>

  </xs:complexType>

</xs:schema>
